package com.yxzz.controller;

import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.yxzz.core.domain.PExamRecord;
import com.yxzz.core.service.IPExamRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 病人检查记录Controller
 *
 * @author ruoyi
 * @date 2023-02-28
 */
@RestController
@RequestMapping("/exam")
public class PExamRecordController extends BaseController
{
    @Autowired
    private IPExamRecordService pExamRecordService;

    /**
     * 查询病人检查记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list(PExamRecord pExamRecord)
    {
        startPage();
        List<PExamRecord> list = pExamRecordService.selectPExamRecordList(pExamRecord);
        return getDataTable(list);
    }


    /**
     * 获取病人检查记录详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(pExamRecordService.selectPExamRecordById(id));
    }

    /**
     * 新增病人检查记录
     */
    @Log(title = "病人检查记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PExamRecord pExamRecord)
    {
        return toAjax(pExamRecordService.insertPExamRecord(pExamRecord));
    }

    /**
     * 修改病人检查记录
     */
    @Log(title = "病人检查记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PExamRecord pExamRecord)
    {
        return toAjax(pExamRecordService.updatePExamRecord(pExamRecord));
    }

    /**
     * 删除病人检查记录
     */
    @Log(title = "病人检查记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(pExamRecordService.deletePExamRecordByIds(ids));
    }
}
